

def setToStr(aSet):
    return "-".join(aSet)

def strToSet(aStr):
    if len(aStr) == 0:
        return set()
    s = aStr.split("-")
    return set(s)

def getDictFormSession(session):
    return {
        "loginType": session.get('loginType', 'invalid'),
        "loginId": session.get('loginId', 'invalid'),
        "loginName": session.get('loginName', 'invalid'),
    }

def checkPermission(request):
    dic = getDictFormSession(request.session)
    if dic['loginType'] == 'invalid' or dic['loginId'] == 'invalid' or dic['loginName'] == 'invalid':
        return False
    else:
        return True